/*********************************************************************
* File: linkGame.h
*
* \brief Export entities from mod DLL back to the HL engine.
*
* \author Instituto Superior Tecnico de Lisboa, Portugal
* \author Technical University of Lisbon, Portugal
* 
* \author Agentes Autonomos e Sistemas Multiagente
* \author Autonomous Agents and Multiagent Systems
* 
* \version	1.0
* \date		2006/2007
*********************************************************************/
#pragma once

#include "engine.h"

typedef void (FAR *LINK_ENTITY_GAME)(entvars_t *);
extern HINSTANCE h_Library;

#define LINK_ENTITY_TO_GAME(mapClassName)                \
   extern "C" EXPORT void mapClassName(entvars_t *pev)   \
   {                                                     \
      static LINK_ENTITY_GAME otherClassName = NULL;     \
      if (otherClassName == NULL)                        \
         otherClassName = (LINK_ENTITY_GAME)GetProcAddress(h_Library, #mapClassName); \
      if (otherClassName == NULL)                        \
         return; (*otherClassName)(pev);                 \
   }
